﻿using QuikGraph;

namespace KinonekoSoftware.Studio.Models.Graphs
{
    public class Classes : RootObject, IEquatable<Classes>
    {
        private string _name;
        private string _color;
        private string _intro;

        public string                        ParentID { get; set; }
        public ObservableCollection<Classes> Children { get; set; }
        
        public string Color
        {
            get => _color;
            set => SetValue(ref _color, value);
        }
        
        
        public string Intro
        {
            get => _intro;
            set => SetValue(ref _intro, value);
        }
        
        public string Name
        {
            get => _name;
            set => SetValue(ref _name, value);
        }
        
        
        public bool Equals(Classes other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return _name == other._name || Id == other.Id;
        }
        
        public override bool Equals(object target)
        {
            if (ReferenceEquals(null, target)) return false;
            if (ReferenceEquals(this, target)) return true;
            if (target.GetType() != this.GetType()) return false;
            return Equals((Classes)target);
        }
        
        public override int GetHashCode()
        {
            return Id.GetHashCode();
        }
    }
    
    public class ClassesRelationship : IEdge<Classes>
    {

        public Classes Source { get; init; }
        public Classes Target { get; init; }
    }
    
    public class ClassesGraph : BidirectionalGraph<Classes, ClassesRelationship>
    {
        
        
    }
}